package com.msmall.community.common.action.html;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.tiles.AttributeContext;
import org.apache.tiles.context.TilesRequestContext;
import org.apache.tiles.preparer.ViewPreparer;

import com.msmall.base.cache.CacheFactory;
import com.msmall.base.util.Constants;
import com.msmall.community.common.model.Link;


/**
 *  获得友情链接
 */
public class LinkPreparer implements ViewPreparer{
	public void execute(TilesRequestContext tilesContext, AttributeContext context) {
		HttpServletRequest request = (HttpServletRequest) tilesContext.getRequest();
		List<Link> links = (List<Link>) CacheFactory.getInstance().getCache(Constants.CACHE_NAME_COMMON).get(Constants.CACHE_KEY_LINK_LIST);
		request.setAttribute("globallinks", links);
	}
}
